{% extends "base.html" %}

{% block title7 %}
    active
{% endblock %}

{% block page-body %}
    <h1 class="page-header">信息查询</h1>

    <!--面板 开始-->
    <div class="panel panel-primary">
    <div class="panel-heading">主机信息</div>
    <div class="panel-body">
        <div class="row">
            <div class="col-md-12 main">
                <form action="/search_hostinfo/" method="post">
                    {% csrf_token %}
                    <div class="col-md-4" style="padding-bottom: 4px;padding-left:0px">
                        <div class="input-group">
                            <input name="ip" id="serach_ip" type="text" class="form-control" placeholder="请输入IP">
                            <span class="input-group-btn"><button style="padding:6px 12px 7px;"
                                                                  class="btn btn-default"
                                                                  type="submit">搜索</button></span>
                        </div><!-- /input-group -->
                    </div>

                </form>
                <table class="table table-bordered table-hover table-condensed text-justify">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>IP</th>
                        <th>厂商</th>
                        <th>业务</th>
                        <th>跳板机</th>
                        {% if request.session.username %}
                            <th>操作</th>
                        {% endif %}
                    </tr>
                    </thead>
                    <tbody>
                    {% for i in vendors %}
                        <tr>
                            <td>{{ forloop.counter }}</td>
                            <td>{{ i.ip }}</td>
                            <td>{{ i.vendor.vendor }}</td>
                            <td>{{ i.service.service }}</td>
                            <td>{{ i.network.jumpserver.server }}</td>
                            {% if request.session.username %}
                                <td>
                                    <a href="/edit_hostinfo/?id={{ i.id }}" class="btn btn-warning btn-sm"
                                       type="button">修改</a>
                                <a class="btn btn-danger btn-sm" href="/del_hostinfo/?id={{ i.id }}">删除</a>
                                </td>
                            {% endif %}
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
                <nav class="pull-right" aria-label="Page navigation">
                    <ul class="pagination">
                        {{ page_info.pager|safe }}
                    </ul>
                </nav>
            </div>
        </div>
        <!--面板body 结束-->
    </div>
{% endblock %}

{% block page-script %}


{% endblock %}